package com.zoey.sdk.utils;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Date;
import java.util.UUID;

/**
 * @Description ID生成器
 * @Author GanShaoXi
 * @ClassName IdGenerater
 * @Return com.zoey.sdk.utils
 * @Since 1.0.0
 * @Created on 2023/6/16 23:08
 */
public class IdGenerater {

    public static String TEN_ZERO_STR = "0000000000";

    /**
     * 获取非自增分布式唯一ID，前八位为精确到天的显式时间，后10位为ip地址+当前时间+uuid的正数hashcode
     * @return
     */
    public static Long getIdWithCloud(){
        Date currentTime = DateUtils.getSystemDate();
        try {
            String hostAddress = InetAddress.getLocalHost().getHostAddress();

        } catch (UnknownHostException e) {
            throw new RuntimeException(e);
        }
        String uuid = UUID.randomUUID().toString();

        return Long.parseLong(uuid);
    }
}
